<?php
namespace Admin\Model;
use Think\Model;

class CategoryModel extends Model
{
    protected $tableName = "category";
    protected $tablePrefix = "dangjian_";

    public function queryAllCate ()
    {
        $res = $this->alias("c")
            ->join("left join dangjian_category_power cp on cp.category_id = c.id")
            ->join("left join dangjian_power p on p.id = cp.power_id")
            ->field("c.id,c.name,p.name power_name,p.url")

            ->select();
        return $res;
    }

    public function queryCate ()
    {
        $res = $this->field("id,name")->select();
        return $res;
    }
}